﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Workflow.Activities;
using Easyleave.Logic.Domain;

namespace Easyleave.Workflow
{
    [ExternalDataExchange()]
	public interface ILocalDataExchangeService
	{
        void SubmitLeave(Guid leaveId, Guid? authorId, LeaveDto leave);
        void RecommendLeave(Guid leaveId, Guid? authorId, string message);
        void ApproveLeave(Guid leaveId, Guid? authorId, string message);
        void RejectLeave(Guid leaveId, Guid? authorId, string message);

        event EventHandler<LeaveSubmittedEventArgs> LeaveSubmitted;
        event EventHandler<LeaveMessageEventArgs> LeaveRecommended;
        event EventHandler<LeaveMessageEventArgs> LeaveApproved;
        event EventHandler<LeaveMessageEventArgs> LeaveRejected;
	}

    [Serializable]
    public class LeaveSubmittedEventArgs : ExternalDataEventArgs
    {
        public LeaveSubmittedEventArgs(Guid leaveId, Guid? authorId, LeaveDto leave)
            : base(leaveId)
        {
            WaitForIdle = true;
            this.Leave = leave;
            this.AuthorId = authorId;
            this.LeaveId = leaveId;
        }
        public Guid? AuthorId { get; set; }
        public Guid LeaveId { get; set; }
        public LeaveDto Leave { get; set; }
    }

    [Serializable]
    public class LeaveMessageEventArgs : ExternalDataEventArgs
    {
        public LeaveMessageEventArgs(Guid leaveId, Guid? authorId, string message)
            : base(leaveId)
        {
            WaitForIdle = true;
            this.LeaveId = leaveId;
            this.AuthorId = authorId;
            this.Message = message;
        }

        public Guid LeaveId { get; set; }
        public Guid? AuthorId { get; set; }
        public string Message { get; set; }
    }
}
